﻿using NUnit.Framework;
using ScrappyDB.Attributes;
using ScrappyDB.BaseClasses;
using ScrappyDB.Utilities;

namespace ScrappyDB.UnitTests
{
    
    
    /// <summary>
    ///This is a test class for AttributeReaderTest and is intended
    ///to contain all AttributeReaderTest Unit Tests
    ///</summary>
    [TestFixture()]
    public class ItemHelperTests
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        [DomainName("TestDomainName"), EntityName("TestEntityName")]
        private class EntityWithAttributes : SdbEntity
        {
        }

        private class EntityWithoutAttributes : SdbEntity
        {
        }

        [Test()]
        public void GetEntityTypeNameTestWithAttributes()
        {
            var o = new EntityWithAttributes();
            const string expected = "TestEntityName";
            string actual = EntityHelper.GetEntityName(o);

            Assert.AreEqual(expected, actual);
        }

        [Test()]
        public void GetEntityTypeNameTestWithoutAttributes()
        {
            var o = new EntityWithoutAttributes();
            const string expected = "EntityWithoutAttributes";
            string actual = EntityHelper.GetEntityName(o);

            Assert.AreEqual(expected, actual);
        }



        [Test()]
        public void GetDomainNameTestWithAttributes()
        {
            var o = new EntityWithAttributes();
            const string expected = "TestDomainName";
            string actual = EntityHelper.GetDomainName(o);

            Assert.AreEqual(expected, actual);
        }

        [Test()]
        public void GetDomainNameTestWithoutAttributes()
        {
            var o = new EntityWithoutAttributes();
            const string expected = "EntityWithoutAttributes";
            string actual = EntityHelper.GetDomainName(o);

            Assert.AreEqual(expected, actual);
        }
    }
}
